using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class TabController : MonoBehaviour {

	public Transform[] tabs;
	public Transform[] tabButtons;

	public void SwitchToTab(int tabNum) {
		for(int i=0; i<tabs.Length; i++) {
			CanvasGroup cg = tabs[i].GetComponent<CanvasGroup>();
			if(i == tabNum) {
				cg.alpha=1;
				cg.interactable = true;
				cg.blocksRaycasts = true;

				tabButtons[i].GetComponent<Image>().color=Color.green;
			}
			else {
				cg.alpha=0;
				cg.interactable = false;
				cg.blocksRaycasts = false;
				tabButtons[i].GetComponent<Image>().color=Color.white;
			}
		}
	}

}
